package main

import (
	"smallList/dao"
	"smallList/models"
	"smallList/routers"
)
import _ "smallList/routers"

func main() {
	err := dao.InitMySQL()
	if err != nil {
		panic(err)
	}
	defer dao.Close() // 程序退出关闭数据库连接
	// 模型绑定
	dao.DB.AutoMigrate(&models.Todo{})
	// 注册路由
	r := routers.SetupRouter()
	r.Run()
}
